await (async function autoRun() {
  // 赌万米（最大套4层）
  let coreCode = [
    {
      times: 10,
      command: [
        {
          times: 2,
          command: ['D', '2', 'L', 'D', 'L', '4', 'D', '6', 'U', 'L', 'D', 'R'],
        },
        'L',
        'D',
      ],
    },
    {
      times: 2,
      command: ['U', 'U', '8', 'R'],
    },
    {
      times: 10,
      command: [
        {
          times: 2,
          command: ['D', '2', 'R', 'D', 'R', '6', 'D', '4', 'U', 'R', 'D', 'L'],
        },
        'R',
        'D',
      ],
    },
    {
      times: 2,
      command: ['U', 'U', '8', 'L'],
    },
  ]

  // 你要改的地方 你要改的地方 你要改的地方
  let loop = 4 // 外层循环次数
  let uid = '1776408434578151' // 你的uid
  let authorization =
    'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsInNvdXJjZSI6Imp1ZWppbiJ9.eyJleHBpcmVBdCI6MTY0MzY3Mjg0OSwidXNlcklkIjoiMTc3NjQwODQzNDU3ODE1MSIsImlhdCI6MTY0MTA4MDg0OSwiZXhwIjoxNjQzNjcyODQ5fQ.aOSV1FRJjfaU1kqjFsVLPFsy4zfrZhdGPlbTFoywxfHdtxLyRjgfqv6kZuKRynODze18PKLmKkPXDVMbPBOVss4soX4OV0NKSYalu1HE1nP8SsVadhzE7pjS7oaHm67qoSmDFS8tJ4XvWvcGEwUv2fGb3E_PnvKL4I4KLw_dIHYBHVs7ybNR_waaS0cqW6g1M7hvn8Xd8urUfz2FO5YvglKPWWh1WOUh_iIcviH0AONpa9UvNq975x88dHgT9NItKNsfZwuX3k88G0zphIkSjg8sxmQmmoV_YWxZq8Mt-R-MJnmitqDKZyUOeJBy-UqMlfs8IwFoNDdep5Dn-vwYGw' // request headers中的authorization
  let gameid =
    'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJnYW1lSWQiOiIyMDIyLTAxLTAyIDA3OjE2OjUzICswODowMCIsInRpbWUiOiIxNjQxMDgwOTU2NjI3IiwiaWF0IjoxNjQxMDgwOTU2LCJleHAiOjE2NDM2NzI5NTZ9.jdgysNwizmQTYXbl8uqIx35tRxT5XRHEDXK3c0ZrkcemLhMJkyYjPW2Kfp1_mOWhkyeQYrBsrHOAAmy7HSNEBQ' // request headers中的x-tt-gameid

  let params = { command: [] }
  let linshiyinyong = params
  for (let i = 0; i < loop; i++) {
    linshiyinyong['command'].push({ times: 10, command: [] })
    linshiyinyong = linshiyinyong.command[0]
    if (i >= loop - 1) {
      linshiyinyong.command.push(...coreCode)
    }
  }
  linshiyinyong = null
  // sea1024 => sea-gold
  let datarus = await fetch(
    'https://juejin-game.bytedance.com/game/sea-gold/game/command?uid=' + uid + '&time=' + Date.parse(new Date()),
    {
      method: 'POST',
      credentials: 'include',
      headers: {
        'Content-type': 'application/json; charset=UTF-8',
        authorization: authorization,
        accept: 'application/json, text/plain, */*',
        'content-length': JSON.stringify(params).length,
        'x-tt-gameid': gameid,
      },
      body: JSON.stringify(params),
    },
  ).then(async res => {
    return res.json()
  })

  return datarus
})()

await (async function autoRun() {
  // 赌万米（最大套4层）

  let coreCode = [
    {
      times: 10,
      command: [
        {
          times: 2,
          command: ['D', '2', 'L', 'D', 'L', '4', 'D', '6', 'U', 'L', 'D', 'R'],
        },
        'L',
        'D',
      ],
    },
    {
      times: 2,
      command: ['U', 'U', '8', 'R'],
    },
    {
      times: 10,
      command: [
        {
          times: 2,
          command: ['D', '2', 'R', 'D', 'R', '6', 'D', '4', 'U', 'R', 'D', 'L'],
        },
        'R',
        'D',
      ],
    },
    {
      times: 2,
      command: ['U', 'U', '8', 'L'],
    },
  ]

  let loop = 4 // 外层循环次数
  let uid = '1776408434578151' // 你的uid
  let authorization =
    'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsInNvdXJjZSI6Imp1ZWppbiJ9.eyJleHBpcmVBdCI6MTY0MzY3NTY3NSwidXNlcklkIjoiMTc3NjQwODQzNDU3ODE1MSIsImlhdCI6MTY0MTA4MzY3NSwiZXhwIjoxNjQzNjc1Njc1fQ.fdN5TkHayRM8w_ibgSavfqOczVspH6gSa7jjdcwfmx8d6YO2nuCCJC3VYPQCdJ6UYEBBL2wQ-0ptWMQUE8wymCoXJRLj59IC6HHwKjHkDHMFa8qU8XJMWKORqqUKZcqD5S66iZ7Ko33_jjYxu4WJZVL_-BHXhNXI-KSwwzLmU7wnD6cGY4fmVqRCbUEmccv75QZNpceaeYK0B1gl9FLIA5HfGBroskVfQbWcpMClEJstHS9kiwUtwS7sisptApSy72ql_otWTS9DDLaFZQQ5fBD0mrnUJXzPaHHX7HEWBjyMFxYoh5sUZzu8UBD0XXezl6suGFl7Z6JWEEkCjda_tw' // request headers中的authorization
  let gameid =
    'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJnYW1lSWQiOiIyMDIyLTAxLTAyIDA4OjE5OjE3ICswODowMCIsInRpbWUiOiIxNjQxMDgzOTI1MTgyIiwiaWF0IjoxNjQxMDgzOTI1LCJleHAiOjE2NDM2NzU5MjV9.iaE18vjuw4XoVe9GjOOExBC5ORlQmsoHp2QS4HHYlu8XJS1DhTfwXaZuHKp45DNcyghX8CHUbj_09frx6aLNUQ' // request headers中的x-tt-gameid

  let params = { command: [] }
  let linshiyinyong = params
  for (let i = 0; i < loop; i++) {
    linshiyinyong['command'].push({ times: 10, command: [] })
    linshiyinyong = linshiyinyong.command[0]
    if (i >= loop - 1) {
      linshiyinyong.command.push(...coreCode)
    }
  }
  linshiyinyong = null

  let datarus = await fetch(
    'https://juejin-game.bytedance.com/game/sea-gold/game/command?uid=' + uid + '&time=' + Date.parse(new Date()),
    {
      method: 'POST',
      credentials: 'include',
      headers: {
        'Content-type': 'application/json; charset=UTF-8',
        authorization: authorization,
        accept: 'application/json, text/plain, */*',
        'content-length': JSON.stringify(params).length,
        'x-tt-gameid': gameid,
      },
      body: JSON.stringify(params),
    },
  ).then(async res => {
    return res.json()
  })

  return datarus
})()
